<!--<%@Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="JQueryStudy._Default"%>-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>test-json</title>
	<script src="common/jquery-1.11.0.js" type="text/javascript"></script>
	<script src="common/json2.js" type="text/javascript"></script>
</head>
<script type="text/javascript">
$(document).ready(function(){
	$("#btnLogin").click(function(){
		//alert("btnLogin");
		OnFormCheck();
		return;
	});
});

function OnFormCheck(){
	var m_userid = $("#userid").val();
	var m_password = $("#passwd").val();
	if(m_userid == ""){
		alert("userid == ''");
		$("#userid").focus();
		return;
	}
	if(m_password == ""){
		alert("password == ''");
		$("#passwd").focus();
		return;
	}
	
	//JSON 데이터 만들기
	var objdata = new data_login(m_userid, m_password);
	var m_senddata = JSON.stringify(objdata);
	alert(m_senddata);
	return;	
}


function Write(){
	var request = $.ajax({
		type: "POST",
		url: "",
		dataType: "json",
		data: para_string,
		success: function(msg){//seccess
			if(msg['result']=="true"){
				alert("success");
				location.href = "./test-json.html";				
			}else{//fail
				alert(msg['error_message']);
			}
		}
	
	});
	
	request.fail(function(jqXHR, textStatus){
		alert("fail");
	});
}

//jQuery 사용 jSon 전송

function data_login(p_userid, p_password){
	this.userid = p_userid;
	this.password = p_password;
}
</script>
<body>
	<form id="form1" runat="server">
		<div>
			<input type="text" id="userid" />
			<input type="password" id="passwd" />
			<input type="button" id="btnLogin" value="Login" />
		</div>
	</form>
</body>
</html>